package alvarodelrosal.chat.server.modelo.chataction;

import java.util.ArrayList;
import java.util.List;

public class ChatActionsFactory {
    private List<ChatAction> actions = new ArrayList();
    
    public ChatActionsFactory() {
        addsAllTheActions();
    }
    
    public ChatAction getFTPAction(String actionName) {
        for(ChatAction action : actions) {
            if(action.getName() == null ? actionName == null : action.getName().equals(actionName)) {
                return action;
            }
        }
        return new ChatOops();
    }
    
    private void addsAllTheActions() {
        actions.add(new ChatAddToChat());
        actions.add(new ChatAllChats());
        actions.add(new ChatAllMyChats());
        actions.add(new ChatAllUsers());
        actions.add(new ChatBye());
        actions.add(new ChatByeChat());
        actions.add(new ChatChat());
        actions.add(new ChatConnectedUsers());
        actions.add(new ChatConversation());
        actions.add(new ChatDeleteUser());
        actions.add(new ChatGetAllUsers());
        actions.add(new ChatGetUserData());
        actions.add(new ChatHello());
        actions.add(new ChatLogin());
        actions.add(new ChatMyChats());
        actions.add(new ChatName());
        actions.add(new ChatNewChat());
        actions.add(new ChatNewUser());
        actions.add(new ChatNoChat());
        actions.add(new ChatOkChat());
        actions.add(new ChatRemoveUser());
        actions.add(new ChatWhoIsIn());
    }
}
